<?php

/**
 * This is the model class for table "kib_c".
 *
 * The followings are the available columns in table 'kib_c':
 * @property string $kode_kc
 * @property string $kode_png
 * @property string $kode_aset
 * @property string $no_reg
 * @property string $kondisi
 * @property string $tingkat
 * @property string $beton
 * @property double $luas_lantai
 * @property string $alamat
 * @property string $tgl_dok
 * @property double $luas_tnh
 * @property string $status_tanah
 * @property string $kode_tnh
 * @property string $asal
 * @property double $harga_prh
 * @property double $harga_pasar
 * @property string $keterangan
 * @property string $kode_milik
 */
class KibC extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'kib_c';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('luas_lantai, luas_tnh, harga_prh, harga_pasar', 'numerical'),
			array('kode_png', 'length', 'max'=>4),
			array('kode_aset', 'length', 'max'=>14),
			array('no_reg, asal', 'length', 'max'=>25),
			array('kondisi, kode_milik', 'length', 'max'=>2),
			array('tingkat, beton', 'length', 'max'=>5),
			array('alamat', 'length', 'max'=>100),
			array('status_tanah, kode_tnh', 'length', 'max'=>35),
			array('tgl_dok, keterangan', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('kode_kc, kode_png, kode_aset, no_reg, kondisi, tingkat, beton, luas_lantai, alamat, tgl_dok, luas_tnh, status_tanah, kode_tnh, asal, harga_prh, harga_pasar, keterangan, kode_milik', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kode_kc' => 'Kode Kc',
			'kode_png' => 'Kode Png',
			'kode_aset' => 'Kode Aset',
			'no_reg' => 'No Reg',
			'kondisi' => 'Kondisi',
			'tingkat' => 'Tingkat',
			'beton' => 'Beton',
			'luas_lantai' => 'Luas Lantai',
			'alamat' => 'Alamat',
			'tgl_dok' => 'Tgl Dok',
			'luas_tnh' => 'Luas Tnh',
			'status_tanah' => 'Status Tanah',
			'kode_tnh' => 'Kode Tnh',
			'asal' => 'Asal',
			'harga_prh' => 'Harga Prh',
			'harga_pasar' => 'Harga Pasar',
			'keterangan' => 'Keterangan',
			'kode_milik' => 'Kode Milik',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kode_kc',$this->kode_kc,true);
		$criteria->compare('kode_png',$this->kode_png,true);
		$criteria->compare('kode_aset',$this->kode_aset,true);
		$criteria->compare('no_reg',$this->no_reg,true);
		$criteria->compare('kondisi',$this->kondisi,true);
		$criteria->compare('tingkat',$this->tingkat,true);
		$criteria->compare('beton',$this->beton,true);
		$criteria->compare('luas_lantai',$this->luas_lantai);
		$criteria->compare('alamat',$this->alamat,true);
		$criteria->compare('tgl_dok',$this->tgl_dok,true);
		$criteria->compare('luas_tnh',$this->luas_tnh);
		$criteria->compare('status_tanah',$this->status_tanah,true);
		$criteria->compare('kode_tnh',$this->kode_tnh,true);
		$criteria->compare('asal',$this->asal,true);
		$criteria->compare('harga_prh',$this->harga_prh);
		$criteria->compare('harga_pasar',$this->harga_pasar);
		$criteria->compare('keterangan',$this->keterangan,true);
		$criteria->compare('kode_milik',$this->kode_milik,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return KibC the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
